package com.jsgt.greekfire.dao.model

import android.os.Parcel
import android.os.Parcelable

class IdentityWallet() :Parcelable{
    var identityName: String? = null
    var isBackup = false
    var portrait: String? = null
    var id: Int = 0
    var identityId: Int = 0
    var walletName: String? = null
    var address: String? = null
    var key: String? = null
    var selection:Int = 0

    constructor(parcel: Parcel) : this() {
        identityName = parcel.readString()
        isBackup = parcel.readByte() != 0.toByte()
        portrait = parcel.readString()
        id = parcel.readInt()
        identityId = parcel.readInt()
        walletName = parcel.readString()
        address = parcel.readString()
        key = parcel.readString()
        selection = parcel.readInt()
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(identityName)
        parcel.writeByte(if (isBackup) 1 else 0)
        parcel.writeString(portrait)
        parcel.writeInt(id)
        parcel.writeInt(identityId)
        parcel.writeString(walletName)
        parcel.writeString(address)
        parcel.writeString(key)
        parcel.writeInt(selection)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<IdentityWallet> {
        override fun createFromParcel(parcel: Parcel): IdentityWallet {
            return IdentityWallet(parcel)
        }

        override fun newArray(size: Int): Array<IdentityWallet?> {
            return arrayOfNulls(size)
        }
    }

}